import request from "@/utils/request";

// 用户登录
export function login(data) {
  return request({
    url: "/user/login",
    method: "post",
    data,
  });
}

// 获取用户列表
export function getUserList(params) {
  return request({
    url: "/user/list",
    method: "get",
    params,
  });
}

// 根据手机号查询用户
export function getUserByPhone(phone) {
  return request({
    url: "/user/find",
    method: "get",
    params: { phone },
  });
}

// 保存或更新用户信息
export function saveUser(data) {
  return request({
    url: "/user/save",
    method: "post",
    data,
  });
}

// 注册用户
export function register(data) {
  return request({
    url: "/user/register",
    method: "post",
    data,
  });
}

// 删除用户
export function deleteUser(id) {
  return request({
    url: `/user/delete/${id}`,
    method: "delete",
  });
}
